package com.gxa.controller.investment;

import com.github.pagehelper.PageInfo;
import com.gxa.common.utils.R;
import com.gxa.common.utils.Result;
import com.gxa.dto.investmentDto.PlanDto;
import com.gxa.service.investment.PlanService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(tags = "招商计划/我的计划")
@RestController
@RequestMapping("/investment/myplan")
public class PlanController {

    @Autowired
    private PlanService planService;
    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("展示我的计划")
    @PostMapping ("/query")
    public Result query(Integer pageNum, Integer pageSize, @RequestBody PlanDto planDto){
        try {
            PageInfo result = planService.queryByPlanDto(pageNum, pageSize, planDto);

            return Result.success(result);
        }catch (Exception e){
            e.printStackTrace();
            return Result.failed("query failed");
        }
    }

//    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
//    @ApiOperation("查询我的计划")
//    @GetMapping("/query")
//    public R queryByCondition(){
//
//        return R.ok("successs").put("plans",plans);
//    }

    @CrossOrigin(origins = "*", maxAge = 3600)//跨越请求配置
    @ApiOperation("导出我的计划")
    @GetMapping("/export")
    public R export(){
        R r = R.ok("successs");
        return r;
    }
}
